﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;

namespace QuotationService.RealtimeQuotation
{
    #region 行情订阅通道类

    /// <summary>
    /// 订阅通道基类
    /// </summary>
    [DebuggerNonUserCode]
    public class QuotationSubscribeChannel : QuotationChannel
    {
        public QuotationSubscribeChannel(QuotationSource source, QuotationDataType dataType = QuotationDataType.All, string code = "")
            : base(source, dataType, code)
        {
            if (source == null)
                throw new ArgumentNullException("source");
        }
    }

    /// <summary>
    /// 市场信息订阅通道
    /// </summary>
    [DebuggerNonUserCode]
    public sealed class MarketInfoSubscribeChannel : QuotationSubscribeChannel
    {
        /// <summary>
        /// 
        /// </summary>
        /// <param name="source"></param>
        public MarketInfoSubscribeChannel(QuotationSource source)
            : base(source, QuotationDataType.MarketInfo)
        {
        }

        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        internal override string ToSubscribeChannel()
        {
            return MarketInfoChannel.ToSubscribeChannel(this.Source);
        }
    }

    /// <summary>
    /// 商品基本资料订阅通道
    /// </summary>
    [DebuggerNonUserCode]
    public sealed class BasicInfoSubscribeChannel : QuotationSubscribeChannel
    {
        /// <summary>
        /// 
        /// </summary>
        string AuthCode = "";

        /// <summary>
        /// 
        /// </summary>
        /// <param name="source"></param>
        /// <param name="code"></param>
        /// <param name="authCode"></param>
        public BasicInfoSubscribeChannel(QuotationSource source, string code = "", string authCode = "")
            : base(source, QuotationDataType.BasicInfo, code)
        {
            this.AuthCode = authCode;
        }

        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        internal override string ToSubscribeChannel()
        {
            return BasicInfoChannel.ToSubscribeChannel(this.Source, this.Code, this.AuthCode);
        }
    }

    /// <summary>
    /// 商品实时行情订阅通道
    /// </summary>
    [DebuggerNonUserCode]
    public sealed class QuotationInfoSubscribeChannel : QuotationSubscribeChannel
    {
        /// <summary>
        /// 
        /// </summary>
        /// <param name="source"></param>
        /// <param name="code"></param>
        public QuotationInfoSubscribeChannel(QuotationSource source, string code = "")
            : base(source, QuotationDataType.Quotation, code)
        {
        }

        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        internal override string ToSubscribeChannel()
        {
            return QuotationInfoChannel.ToSubscribeChannel(this.Source, this.Code);
        }
    }

    #endregion

}
